package org.example.struct.array;

/**
 * @author liyishan
 * @date 2024/8/27 10:12
 * @apiNote
 */

public class Test01103DistributeCandies {
    public int[] distributeCandies(int candies, int num_people) {
        int[] ans = new int[num_people];
        int i = 0;
        while(candies != 0){
            ans[i % num_people] += Math.min(i+1, candies);
            candies -= Math.min(i+1, candies);
            i++;
        }
        return ans;
    }
}
